<template>
  <div class="p-d">
    <div class="b-f p-d">
      <el-tabs v-model="activeName">
        <el-tab-pane label="全部"
          name="all"></el-tab-pane>
        <el-tab-pane label="待处理"
          name="wait"></el-tab-pane>
        <el-tab-pane label="已处理"
          name="noWait"></el-tab-pane>
      </el-tabs>
      <SearchComp :searchForm="searchForm"
        :searchData="queryString"
        :searchAction="searchAction"></SearchComp>
      <div class="m-t">
        <TableCompEle class="m-t"
          ref="multipleTable"
          height="50vh"
          :tableData="tableData"
          :tableConfig="tableConfig"
          :tableAction="tableAction"
          :isSelect="true"
          :isIndex="true"
          :isShowPage="true"
          :queryParams="queryParams"
          @getPagination="getList"
          @handleSelectionChange="handleSelectionChange"></TableCompEle>
      </div>
    </div>
    <AddComp ref="addRef"
      @close="getList" />
  </div>
</template>

<script>
import suggestList from '@/suggestList.json'
import AddComp from './common/add.vue'
export default {
  components: { AddComp },
  data() {
    return {
      activeName: 'all',
      queryParams: {
        total: 3,
        currentPage: 1,
        pageSize: 10
      },
      tableData: suggestList,
      tableConfig: [
        {
          prop: 'title',
          label: '提问标题'
        },
        {
          prop: 'type',
          label: '提问类型',
          width: '160px'
        },
        {
          prop: 'name',
          label: '提问人',
          width: '120px'
        },
        {
          prop: 'createdTime',
          label: '提问时间',
          width: '180px'
        }
      ],
      tableAction: {
        align: () => 'center',
        width: () => String(100),
        operations: [
          {
            label: '查看',
            isLink: true,
            type: 'primary',
            method: row => {
              this.$refs.addRef.show({
                title: '查看建言献策',
                isLook: 'look',
                data: row
              })
            }
          },
          {
            label: '回复',
            isLink: true,
            type: 'primary',
            method: row => {
              this.$refs.addRef.show({
                title: '回复建言献策',
                isLook: 'answer',
                data: row
              })
            }
          }
        ]
      },
      queryString: {
        title: '',
        source: ''
      },
      searchForm: {
        changeMethod: () => {
          this.queryParams.currentPage = 1
          this.getList()
        },
        formData: [
          {
            type: 'Input',
            label: '提问标题',
            prop: 'title',
            clearable: true,
            icon: 'el-icon-search',
            placeholder: '请输入'
          },
          {
            type: 'Input',
            label: '提问类型',
            prop: 'source',
            clearable: true,
            icon: 'el-icon-search',
            placeholder: '请输入来源'
          }
        ]
      },
      searchAction: [
        {
          label: '查询',
          type: 'primary',
          handle: () => {
            this.queryParams.currentPage = 1
            this.$refs.multipleTable.clearSelection()
            this.getList()
          }
        },
        {
          label: '重置',
          type: 'primary',
          plain: true,
          handle: () => {
            this.queryString = {
              title: '',
              source: ''
            }
            this.queryParams.currentPage = 1
            this.getList()
          }
        }
      ]
    }
  },
  methods: {
    getList() {}
  }
}
</script>

<style lang="less" scoped>
</style>